// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//

#pragma once

#include <cantor/unresolved/visitor.h>

namespace cantor::unresolved {
    class UnresolvedColumnName;
    class UnresolvedStatement;
    class UnresolvedTableName;

    class UnresolvedAlterViewStmt : public UnresolvedVisitor<UnresolvedAlterViewStmt> {
    public:
        static constexpr const cantor::pb::ast::StmtType TYPE = cantor::pb::ast::StmtType::STMT_ALTER_VIEW;

        UnresolvedAlterViewStmt(const cantor::pb::ast::AlterViewStmt &node) : instance(node) {
        }

        UnresolvedAlterViewStmt(const cantor::pb::ast::Statement &node) : instance(node.alter_view_stmt()) {
        }

        ~UnresolvedAlterViewStmt() override = default;

        const pb::Location &location_impl() const {
            return instance.location();
        }

        const pb::Status &error_status_impl() const {
            return instance.status();
        }

        UnresolvedTableName view_name() const;

        size_t column_names_size() const {
            return instance.column_names_size();
        }

        UnresolvedColumnName column_names(int index) const;

        bool has_view_select_stmt() const {
            return instance.has_view_select_stmt();
        }

        UnresolvedStatement view_select_stmt() const;

        const cantor::pb::ast::AlterViewStmt &instance;
    };
} // namespace cantor::unresolved
